package com.ecloud.common.exception;


import com.ecloud.common.ResultEnum;

/**
 * 服务异常 只支持ResultEnum的构造
 * 详情: {@link ResultEnum}
 * <p>
 * 通过该异常抛出后会在全局异常处理器进行捕获 并返回JsonResult
 *
 * @author Squbi
 * @date 2021/3/31 14:37
 */
public class ServerException extends RuntimeException {

    private final ResultEnum result;

    private final String msg;

    public ServerException(ResultEnum result) {
        this.result = result;
        this.msg = null;
    }

    public ServerException(ResultEnum result, String msg) {
        this.result = result;
        this.msg = msg;
    }

    public ResultEnum getResult() {
        return result;
    }

    public String getMsg() {
        return msg;
    }
}
